home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
utilmus
/
octv5tt4.lha
/
Docs
/
ARexx&OctaMED.txt.pp
/
ARexx&OctaMED.txt
Wrap
Text File
|
1980-01-01
|
8KB
|
182 lines
ARexx and OctaMED
An exploration of multi-tasking
For multimedia applications
An Article written for RBF Software by Gareth R.Craft
In 1991, the Amiga won the 'European Home Computer of the Year' award. Its
supeior Graphic users Interface, multi-tasking, and impressive graphic and
sound abilities have brought a new level of computing power to the 'home' user.
Now, one thing that everybody expects from any personal computer is the ability
to offer control and automation over all its tasks. This was true even when
home computers were paltry affairs by today's standards. As users become less
dazzled by the abilities of the machine, they become more intrested in how to
use it practically themselves. This shift from passive to a more active style
of home computing stresses the need for a personal programming language for the
Amiga.
The lay person could well be excused for thinking that such a language should
come automatically with the computer. In an ideal world that may be the case,
but in reality, good software always takes time to follow the hardware. For
many reasons, neither AmigaBASIC nor AmigaODS ever became popular for personal
programming. A substantial vacuum existed in this area. That was until the
long awaited release of Workbench 2.0 on the Amiga which introduced a new
contender in the personal programming lamguage stakes - Arexx.
ARexx is derived from the REXX language used on the big computers for script
control and interprocess communication. It was implemented on the Amiga by
Bill Hawes, a programmer with some impressive programs to his name. It is
generally agreed that the implementation is extremely sound, and that it takes
special advantage of the Amiga's features. ARexx is not a new language, and
has had something of a cult following for quite a while, especially among US
programmers. However, once its super-practical nature started to become
apparent, more and more people became interested. Today, many serious
applications have ARexx support and Teijo Kinunen's OctaMED is a good example
where multi-tasking and multi-media follow this new ARexx tradition. What
follows is a discussion of some of the ARexx Commands and writing an ARexx
script for the OctaMEDPlayer and multi-tasking.
The ARexx ADDRESS instruction, which has a number of forms including 'address
COMMAND' is the method used to communicate with the underlying AmigaDOS by
setting up an ARexx host address.
e.g.
If we have OctaMEDPlayer in df0: we can use ARexx to ask AmigaDOS to load and
run the program.
/* Music Example.rexx */
address command ' run df0:OCTAMEDPLAYER'
say 'loading OCTAMEDPLAYER Program'
Now in order to send some messages from ARexx to our host address
OctaMEdPlayer, this port must actually exist, and due to the time taken for
AmigaDOS to load and run a program it is necessary to instruct ARexx via a
script to wait until this program has started.
The ARexx 'WaitForPort' instruction is used for this purpose, asking ARexx to
run the WaitForPort utility and wait for OctaMEDPlayer to set up its
communication port...
address command 'WaitForPort
OCTAMEDPLAYER
Once the port is found and the ARexx script reawakens, it is possible to set
ARexx's current host address to OCTAMEDPLAYER using the following form of the
ADDRESS instruction...
address 'OCTAMEDPLAYER'
/* Speak to Player' */
We could for example create an ARexx script to load up a module, play it for a
while, stop it, diplay some kind of closing down message and the quit
OctaMeDPlayer.
/* Music Example 1.rexx */
address command 'run df0:OctaMEDPlayer'
say 'loading OctaMEDPlayer program'
address command 'WaitForPort'
OCTAMEDPLAYER
address 'OCTAMEDPLAYER /* Speak to the Player */
'Loadmod df0:mysong' /* load specified song */
'Play' /* Start Playing */
Call Delay (20 * 50) /* Play for 20 Seconds */
'Stop' /* Stop Playing */
Say 'Closing down OctaMEDPlayer Program'
'quit' /* Shut Down PLayer */
Note:-
LOADMOD, PLAY, STOP and QUIT are not ARexx commands but are in fact
instructions implemented by the programmer in the OctaMEDPlayer interface.
Since the above script contains the ARexx delay() function, it is necessary to
install the "rexxsupport.library" before it is run. Typing in the at the prompt
in the AmigaDOS Shell:-
RXLIB rexxsupport.library 0 -30 0
will preload it for us.
Alternatively we can ammend the script to check for and install the library
accordingly.
/* Music Example 2.rexx' */
If ~Show('L','rexxsupport.library')
then do
Say 'adding rexxsupport library'
Call AddLib('rexxsupport.library',0,30,0)
end
address Command 'run df0:OctaMedPlayer'
Say 'Loading OctaMEDPLayer Program'
address command 'WaitForPort OCTAMEDPLAYER'
address 'OCTAMEDPLAYER' /* Talk to the Player */
'loadmod df0:mysong' /* Load the specified song */
'Play' /* Start Playing */
Call delay (20 * 50) /* Play for 20 seconds */
'Stop' /* Stop Playing */
say 'Closing down OctaMEDPlayer Program'
'quit' /*Shut down the Player */
ARexx scripts normally tend to do more difficult jobs and so need rather more
error checking code. What is not apparent in this example is in fact that
often the result of the ARexx involvement will be that the combined power of
the various parts of an application is actually greater thean the individual
components. With a little modification our example script could be made to
control the OctaMEDPlayer at the sametime as controlled an IFF picture display
generated by another ARexx controllable program - the net result then would be
an integrated sound/visual multimedia type presentation that neither program
could have acheived on its own.
Gareth R.Craft.
Further Reading
---------------
ARexx Programming on the Amiga
by Chris Zamara
Published by Abacus
Price £30
Using ARexx on the Amiga
Published by DTBS Books
Price £29.95
The ARexx Language: The Practice Approach to Programming
By M.F. Conlishan
ISBN No. 1-3-7806521-1
Price £40
Gareth R.Craft
12 Mount Road
Halton
Runcorn
Cheshire. WA7 2BH.
England. U.K.
Tel: +44 0928 563762